package com.example.highclasscomponent;

import androidx.appcompat.app.AppCompatActivity;
import androidx.viewpager.widget.PagerTabStrip;
import androidx.viewpager.widget.ViewPager;

import android.graphics.Color;
import android.os.Bundle;
import android.util.TypedValue;
import android.view.View;

import com.example.highclasscomponent.adapter.ImagePagerAdapter;
import com.example.highclasscomponent.adapter.MobilePageAdapter;
import com.example.highclasscomponent.pojo.GoodsInfo;

import java.util.ArrayList;

public class FragmentDynamicActivity extends AppCompatActivity {

    private ArrayList<GoodsInfo> mGoodsList;
    private ViewPager vp_content;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_fragment_dynamic);
        vp_content = findViewById(R.id.vp_content);
        mGoodsList = GoodsInfo.getDefaultList();
        intiPagerView();
        initPagerStrip();
    }

    private void intiPagerView() {
        MobilePageAdapter adapter = new MobilePageAdapter(getSupportFragmentManager(), mGoodsList);
        vp_content.setAdapter(adapter);
    }

    private void initPagerStrip() {
        PagerTabStrip pagerStrip = findViewById(R.id.pts_tab);
        pagerStrip.setTextSize(TypedValue.COMPLEX_UNIT_SP, 20);
        pagerStrip.setBackgroundColor(Color.RED);
    }
}